@extends('shop::layouts.master')
@section('title')
    服务订单详情
@endsection
@section('tab')
    <div style="padding: 20px; background-color: #F2F2F2;">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md6" style="height: 500px;">
                <div class="layui-card">
                    <div class="layui-card-header">订单信息</div>
                    <div class="layui-card-body">
                        订单编号：{{$info['order_sn']}} <br>
                        服务类型：{{$info['pid_msg']}}<br>
                        订单价格：{{$info['price']}} <br>
                        支付状态：{{$info['pay_status']['name']}} <br>
                        支付方式：{{$info['pay_type']['name']}} <br>
                        订单状态：{{$info['status']['name']}} <br>
                        支付时间：{{$info['pay_time']}}<br>
                        下单时间：{{$info['created_at']}}<br>
                        @if( $info['status']['id'] == 2 || $info['status']['id'] == 22 || $info['status']['id'] == 21 )
                            退款单号：{{$info['refund_no']}} <br>
                            退款原因：{{$info['refubd_msg']}}<br>
                            扣除金额：￥{{$info['deduct_price']}}<br>
                            退款金额：￥{{$info['refund_price']}}<br>
                            申请时间：{{ date( 'Y-m-d H:i:s' , $info['refund_time'] )}}<br>
                            @if( $info['status']['id'] == 22 )
                                退款时间：{{$info['refund_time_success']}}<br>
                            @endif
                        @endif
                    </div>
                </div>
            </div>

            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header">客户信息</div>
                    <div class="layui-card-body">
                        下单用户：{{$info['user']['nickname']}}<br>
                        用户头像：<img src="{{$info['user']['head_img']['full_src']}}" style="width: 100px; height: 100px;"> <br>
                    </div>

                    <div class="layui-card-body">
                        车牌号：{{$info['carorg']}} {{$info['plate_no']}}<br>
                        联系人：{{$info['contacts']}} <br>
                        联系电话：{{$info['phone']}} <br>
                        起点位置：{{$info['address']}}
                        目的地址：{{$info['destination']}} <br>
                    </div>
                </div>
            </div>

            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header">评论信息</div>
                    <div class="layui-card-body" style="overflow-y: hidden;">
                        评价分数：{{$info['apprise']['score']}}<br>
                        评价内容：{{$info['apprise']['content']}} <br>
                        评价图片：@foreach(  $info['apprise']['images']  as $key=>$vo )
                                        <img src="{{oss_full_url( $vo )}}" style=" width: 200px;">
                                 @endforeach
                    </div>
                </div>
            </div>


        </div>
    </div>

@endsection

@section('tab_js')
    <script>
        $(document).on('click', '.layui-btn', function () {
            var that = $(this);
            var id = that.data('id');
            var state = that.data('state');
            var pay_state = that.data('pay_state');

            layer.confirm(that.data('title'), {btn: ['确定', '取消']}, function () {
                $.ajax({
                        url: "shop-order-repair-chang-status",
                        type: 'post',
                        dataType: "json",
                        data: {id: id, status: state, pay_status: pay_state},
                        success: function (result) {
                            if (result.state === 0) {
                                layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                                    location_refresh();
                                });
                            } else {
                                layer.msg(result.msg, {time: 2000, icon: 5});
                            }
                        }
                    }
                );
            });
        });
    </script>

@endsection